#ifndef MyMath_H
#define MyMath_H
#include "typedef.h"
#include  "Fifo16.h"
#define FilterLen 8


typedef struct
{
   uint64 PowerSum;
   int32 Sum;
   uint16 PointCount;
 //  Fifo16 filterFifo;
 //  uint16  filterSum;
 //  uint16  filterBuf[FilterLen];
   uint32  preVal;
   uint32  preInputVal;
} VoltCalcer;

void Voltcalcer_Init(VoltCalcer *calcer);
void VoltCalcer_AddValue(VoltCalcer *calcer,uint32 val);
uint32 CalcAcVal(VoltCalcer * calcer);
void VoltCalcer_Reset(VoltCalcer *calcer);
uint32 Sqrt_UInt32(unsigned long M);
#endif  //MyMath_H
